import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
import Unocss from "unocss/vite";
import { viteMockServe } from "vite-plugin-mock";

export default defineConfig(({ command, mode }) => {
  const isBuild = command === "build";

  return {
    resolve: {
      alias: [
        {
          find: "@",
          replacement: resolve(__dirname, "./src"),
        },
      ],
    },
    plugins: [
      vue(),
      Unocss(),
      viteMockServe({
        mockPath: "mock",
        enable: true,
        ignore: /^_/,
      }),
    ],
  };
});
